package com.share.hello.rest;

import com.share.hello.model.User;
import com.share.hello.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author caifan
 * @created 2021/12/18
 * @description:
 */
@RestController
@RequestMapping("/user")
public class UserRest {

    @Autowired
    private UserService userService;

    @GetMapping("/getById")
    public User getUserById(@RequestParam Long id) {
        return userService.getUserById(id);
    }

    @PostMapping("/add")
    public Boolean addUser(@RequestBody User user) {
        return userService.addUser(user);
    }
}
